<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<!DOCTYPE html>
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title><h:outputText value="#{msg.usl_home_title}" /></title>
            <link href="<% out.print(request.getContextPath());%>/resources/css/position.css" rel="stylesheet" type="text/css" />

        </head>
        <body>

            <jsp:include page="/pages/fragments/header.jsp" />


            <jsp:include page="/pages/fragments/uslMenu.jsp" />


            <section>  
                <h:form>
                    <rich:panel >

                        <f:facet name="header">
                            <h:outputText value="#{msg.description_pending}"/>
                        </f:facet>

                        <h:panelGrid columns="2" style="margin-bottom: 30px">

                            <h:outputText value="#{msg.select_days}" />
                            
                            <rich:inputNumberSlider value="#{beanNotifica.giorni}" maxValue="100" width="300" style="position: fixed;" >
                                <a4j:support event="onchange" reRender="tabella"/>
                            </rich:inputNumberSlider>
                            
                        </h:panelGrid>

                        <rich:extendedDataTable value="#{beanNotifica.patientList}" var="entry"  id="tabella" styleClass="wide">

                            <rich:column sortBy="#{entry[0]}" label="#{msg.patient_name}" width="25%">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.patient_name}"/>
                                </f:facet>
                                <h:outputText value="#{entry[0]}" />
                            </rich:column>

                            <rich:column sortBy="#{entry[1]}" width="25%" label="#{msg.last_name}">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.last_name}"/>
                                </f:facet>
                                <h:outputText value="#{entry[1]}"/>
                            </rich:column>

                            <rich:column sortBy="#{entry[2]}" width="25%" label="#{msg.examinations}">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.examinations}"/>
                                </f:facet>
                                <h:outputText value="#{entry[2]}" rendered="#{beanNotifica.colore(entry[2])}" style="color: red">
                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                </h:outputText> 
                                <h:outputText value="#{entry[2]}" rendered="#{!beanNotifica.colore(entry[2])}">
                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                </h:outputText> 
                            </rich:column>                         

                            <rich:column  width="25%" style="text-align:center;">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.checked}"/>
                                </f:facet>
                                <h:selectBooleanCheckbox id="checkEntry" value="#{beanNotifica.selectedListTmp[entry]}"  disabled="false"/>
                            </rich:column> 
                        </rich:extendedDataTable>


                        <h:commandButton value="#{msg.send_notifications}" action="#{beanNotifica.sendNotification()}" />

                    </rich:panel>
                </h:form>

            </section>






        </body>
    </html>
</f:view>
